//
//  JDBaseVCHXAblumExtension.swift
//  DragonWallet
//
//  Created by volantPig on 2024/11/24.
//

import UIKit
import HXPhotoPicker

class JDBaseVCHXAblumExtension: NSObject {

}


extension JDBaseViewController {
    
//    func openHXAlbumAlert(_ selectedCompleted: @escaping ((AblumType,[UIImage])->())) {
//        
//        let alertVC = UIAlertController(title: "请选择上传方式", message: "", preferredStyle: .actionSheet)
//        
//        let albumAction = UIAlertAction(title: "相册", style: .default) {[weak self] _ in
////            self?.openAlbum { images in
////                if let imgs = images, imgs.count > 0 {
////                    selectedCompleted(.photoAblum, imgs)
////                }
////            }
//        }
//        
//        let cameraAction = UIAlertAction(title: "相机", style: .default) { _ in
////            selectedCompleted(.photoCamera,[UIImage]())
//        }
//        
//        let cancelAction = UIAlertAction(title: "取消", style: .cancel) { _ in
//        }
//        alertVC.addAction(albumAction)
//        alertVC.addAction(cameraAction)
//        alertVC.addAction(cancelAction)
//        alertVC.modalPresentationStyle = .fullScreen
//        self.present(alertVC, animated: true)
//    }
//    
//    /// 选择视频
//    func openHXVideoAlert(_ selectedCompleted: @escaping ((AblumType,UIImage,String)->())) {
//        
//        let alertVC = UIAlertController(title: "请选择上传方式", message: "", preferredStyle: .actionSheet)
//        
//        let albumAction = UIAlertAction(title: "录像", style: .default) {[weak self] _ in
//            self?.startVideo()
//        }
//        
//        let cameraAction = UIAlertAction(title: "本地视频", style: .default) {[weak self] _ in
//            self?.openVideo(selectedCompleted: { videoImage, videoUrlPath in
//                if let image = videoImage, let utlPath = videoUrlPath {
//                    selectedCompleted(.videoAblum, image, utlPath)
//                }
//            })
//        }
//        
//        let cancelAction = UIAlertAction(title: "取消", style: .cancel) { _ in
//            
//        }
//        alertVC.addAction(albumAction)
//        alertVC.addAction(cameraAction)
//        alertVC.addAction(cancelAction)
//        alertVC.modalPresentationStyle = .fullScreen
//        self.present(alertVC, animated: true)
//    }
//    
//    /// 打开图片相册
//    /// - Parameters:
//    ///   - maxImagesCount: 最多可以选择几张照片
//    ///   - columnNumber: 每行展示几张照片
//    ///   - delegate: 代理
//    func openHXAlbum(maxImagesCount: Int = 3 , columnNumber: Int = 4, selectedCompleted: @escaping (([UIImage]?)->())) {
//       
//        
//    }
//    
////    var selectedVideoCompleted: ((UIImage?,String?)->())?
//    
//    func openHXVideo(maxImagesCount: Int = 1 , columnNumber: Int = 4, selectedCompleted: @escaping ((UIImage?,String?)->())) {
//        
//        
//    }
    
    func prePhotos(currentIndex: Int) {
        
        var style: UIModalPresentationStyle = .custom
        var config = HXPhotoPicker.PhotoBrowser.Configuration()
        config.showDelete = false
            config.modalPresentationStyle = style
        
        /// 显示图片浏览器
        /// - Parameters:
        ///   - previewAssets: 对应 PhotoAsset 的数组
        ///   - pageIndex: 当前预览的位置
        ///   - config: 相关配置
        ///   - fromVC: 来源控制器
        ///   - transitionalImage: 初始转场动画时展示的 UIImage
        ///   - transitionHandler: 转场过渡
        ///   - deleteAssetHandler: 删除资源
        ///   - longPressHandler: 长按事件
        /// - Returns: 对应的 PhotoBrowser
        
        HXPhotoPicker.PhotoBrowser.show([PhotoAsset.init(networkImageAsset: NetworkImageAsset.init(thumbnailURL: URL(string: "https://ww1.sinaimg.cn/mw690/717076a7gy1hse09y4a0pj21jk2bcqms.jpg"), originalURL: nil))], pageIndex: currentIndex, config: config, fromVC: nil, transitionalImage: nil, transitionHandler: nil, transitionCompletion: nil, deleteAssetHandler: nil, longPressHandler: nil)
        
//        "https://ww1.sinaimg.cn/mw690/717076a7gy1hse09y4a0pj21jk2bcqms.jpg"
     
        
    }
    
}
